'''
Created on 2012-3-26

@author: Wang_ZJ
'''
# debug mode
g_debug = True

# get current directory
g_base_path = ''

# database configurations
g_dburi = g_dbengine = g_dbmeta = g_dbsession = None

# logger
g_logger = None

# memcached
g_cache = None
from functools import wraps
def g_getcache(key, expireseconds=60):
    if not g_cache: return None
    obj = g_cache.get(key)
    print 'get obj = ', obj
    if obj: return obj
    def _inner_get(func):
        @wraps(func)
        def _inner(*args, **kwargs):
            obj = func(*args, **kwargs)
            g_cache.set(key, obj, expireseconds)
            print 'set obj = ', obj
            return obj
        return _inner
    return _inner_get